/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author GilJSA
 */
@Entity
@Table(name = "convenios")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Convenios.findAll", query = "SELECT c FROM Convenios c"),
    @NamedQuery(name = "Convenios.findByIdConvenios", query = "SELECT c FROM Convenios c WHERE c.idConvenios = :idConvenios")})
public class Convenios implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idConvenios")
    private Integer idConvenios;
    @JoinColumn(name = "cMarco_idMarco", referencedColumnName = "idMarco")
    @ManyToOne(optional = false)
    private Cmarco cMarcoidMarco;
    @JoinColumn(name = "cEspecifico_idcEspecifico", referencedColumnName = "idcEspecifico")
    @ManyToOne(optional = false)
    private Cespecifico cEspecificoidcEspecifico;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "conveniosidConvenios")
    private Collection<PropuestaEconomicaOnline> propuestaEconomicaOnlineCollection;

    public Convenios() {
    }

    public Convenios(Integer idConvenios) {
        this.idConvenios = idConvenios;
    }

    public Integer getIdConvenios() {
        return idConvenios;
    }

    public void setIdConvenios(Integer idConvenios) {
        this.idConvenios = idConvenios;
    }

    public Cmarco getCMarcoidMarco() {
        return cMarcoidMarco;
    }

    public void setCMarcoidMarco(Cmarco cMarcoidMarco) {
        this.cMarcoidMarco = cMarcoidMarco;
    }

    public Cespecifico getCEspecificoidcEspecifico() {
        return cEspecificoidcEspecifico;
    }

    public void setCEspecificoidcEspecifico(Cespecifico cEspecificoidcEspecifico) {
        this.cEspecificoidcEspecifico = cEspecificoidcEspecifico;
    }

    @XmlTransient
    public Collection<PropuestaEconomicaOnline> getPropuestaEconomicaOnlineCollection() {
        return propuestaEconomicaOnlineCollection;
    }

    public void setPropuestaEconomicaOnlineCollection(Collection<PropuestaEconomicaOnline> propuestaEconomicaOnlineCollection) {
        this.propuestaEconomicaOnlineCollection = propuestaEconomicaOnlineCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idConvenios != null ? idConvenios.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Convenios)) {
            return false;
        }
        Convenios other = (Convenios) object;
        if ((this.idConvenios == null && other.idConvenios != null) || (this.idConvenios != null && !this.idConvenios.equals(other.idConvenios))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Convenios[ idConvenios=" + idConvenios + " ]";
    }
    
}
